package com.design.pattern.command.projection;

import java.util.List;

/**
 * 喇叭
 */
public class Loudspeaker {
    private List<Student> students;//此时喇叭需要了解他要把命令发送给谁.

    public Loudspeaker(List<Student> students) {
        this.students = students;
    }

    /**
     * 广播命令
     * @param command 命令
     */
    void spreadTheOrder(Command  command){
        for (Student student:students){
            student.execute(command);
        }
    }
}
